﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Classes
{
    public class DBClientes
    {
        IList<Cliente> clienteList;

        public DBClientes()
        {
            this.clienteList = new List<Cliente>();
            Cliente nuevo = new Cliente("Mariana", "Perez de Pedro", "31061068", "aleu 3139", "47551451", "07-11-1984", "Arg");
            Cliente nuevo2 = new Cliente("Lali", "Ibarbia", "31659163", "aleu 3139", "47551451", "12-07-1984", "Arg");
            Cliente nuevo3 = new Cliente("Fede", "Mansilla", "30513824", "aleu 3139", "47551451", "07-12-1984", "Arg");
            Cliente nuevo4 = new Cliente("Rober", "Gadea", "31061898", "aleu 3139", "47551451", "07-11-1984", "Arg");
         
            nuevo.addCuotaInicial();
            nuevo2.addCuotaInicial();
            nuevo3.addCuotaInicial();
            nuevo4.addCuotaInicial();

            nuevo.addVehiculo(new Vehiculo("HOLA", "XX1", "1234", "BMW", "ULTIMO", DateTime.Parse("11-11-2011"), new Scoring("DesInicial", 0)));
            nuevo2.addVehiculo(new Vehiculo("HOLA", "XX1", "1234", "BMW", "ULTIMO", DateTime.Parse("11-11-2011"), new Scoring("DesInicial", 0)));
            nuevo3.addVehiculo(new Vehiculo("LOL320", "XX1", "1234", "BMW", "X6", DateTime.Parse("11-11-2011"), new Scoring("DesInicial", 0)));
            nuevo4.addVehiculo(new Vehiculo("HOLA", "XX1", "1234", "BMW", "ULTIMO", DateTime.Parse("11-11-2011"), new Scoring("DesInicial", 0)));

            this.clienteList.Add(nuevo);
            this.clienteList.Add(nuevo2);
            this.clienteList.Add(nuevo3);
            this.clienteList.Add(nuevo4);
           
        }

        public Boolean AgregarCliente(Cliente cliente)
        {
            this.clienteList.Add(cliente);
            return true;
        }

        public bool VerificarClienteExistente(Cliente cliente)
        {
            if (this.clienteList.Contains(cliente))
            {
                Console.WriteLine("El Cliente ya existe en la lista");
                return false;
            }
            return true;
        }

        public IList<Cliente> VerClientes()
        {
            return this.clienteList;
        }

        public Cliente GetCliente(string dni)
        {
            foreach (Cliente c in clienteList)
            {
                if (c.Dni == dni) return c;
            }
            return null;
        }
    }
}
